package com.apes.scm.masterdata.product.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.masterdata.product.model.CategorySupplyRange;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.scm.masterdata.product.repository
 * @ClassName: CategorySupplyRangeRepository
 * @Author: pyb
 * @CreateTime: 2020-02-13 15:40
 * @Description:
 * @Version: 1.0
 */
public interface CategorySupplyRangeRepository extends CustomRepository<CategorySupplyRange, String> {

    @Query("SELECT T FROM CategorySupplyRange T WHERE classify.id = :value")
    int findExisPL(@Param("value")String PLID);

    @Query(value = "SELECT T.* FROM mas_category_supply_range T WHERE :clasifyId like classify_id || '%'", nativeQuery = true)
    List<CategorySupplyRange> findLikeCategorySupplyRange(@Param("clasifyId") String classifyId);
}
